﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using CommonExtensions.ObjectExtensions;
using CommonExtensions.StringExtensions;

namespace DBMigrator.Core.DbObjects.Data.Select.From.Join
{
    public class JoinOn : IJoinOn
    {
        public string JoinColumnName { get; private set; }
        public IJoinTable JoinTable { get; private set; }

        protected JoinOn(IJoinTable joinTable)
        {
            if(joinTable.IsNull())
                throw new ArgumentNullException("joinTable");

            JoinTable = joinTable;
        }

        public IJoinTable On(string joinColumnName)
        {
            if(joinColumnName.IsBlank())
                throw new ArgumentNullException("joinColumnName");

            JoinColumnName = joinColumnName;

            return JoinTable;
        }
    }
}
